package com.scala.oop.triat

/**
 * Created by Administrator on 2018/1/28/028.
 *
 * 混入trait
 */
trait Logged {
  def log(msg:String): Unit ={

  }
}

trait MyLogged extends  Logged{
 override def log(msg:String): Unit ={
    println("log:"+msg)
  }
}

class Man(val name:String) extends  Logged{

  def SayHello(): Unit ={
    println("hello ," + name)
    log("this is 混入。")
  }


}

object HunruTest{
  def main(args: Array[String]) {
    val m = new Man("Eric")
    m.SayHello()
    val m2 = new Man("HUNRU") with MyLogged
    m2.SayHello
  }
}



